home *** CD-ROM | disk | FTP | other *** search
-
-
-
- MMMMAAAALLLLLLLLOOOOCCCC____SSSSSSSS((((3333)))) MMMMAAAALLLLLLLLOOOOCCCC____SSSSSSSS((((3333))))
-
-
-
- NNNNAAAAMMMMEEEE
- malloc, free, realloc, calloc, memalign, valloc, ssmalloc_error -
- SpeedShop memory allocation library
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddlllliiiibbbb....hhhh>>>>
-
- vvvvooooiiiidddd ****mmmmaaaalllllllloooocccc ((((ssssiiiizzzzeeee____tttt ssssiiiizzzzeeee))));;;;
-
- vvvvooooiiiidddd ffffrrrreeeeeeee ((((vvvvooooiiiidddd ****ppppttttrrrr))));;;;
-
- vvvvooooiiiidddd ****rrrreeeeaaaalllllllloooocccc ((((vvvvooooiiiidddd ****ppppttttrrrr,,,, ssssiiiizzzzeeee____tttt ssssiiiizzzzeeee))));;;;
-
- vvvvooooiiiidddd ****ccccaaaalllllllloooocccc ((((ssssiiiizzzzeeee____tttt nnnneeeelllleeeemmmm,,,, ssssiiiizzzzeeee____tttt eeeellllssssiiiizzzzeeee))));;;;
-
- vvvvooooiiiidddd ****mmmmeeeemmmmaaaalllliiiiggggnnnn ((((ssssiiiizzzzeeee____tttt aaaalllliiiiggggnnnnmmmmeeeennnntttt,,,, ssssiiiizzzzeeee____tttt ssssiiiizzzzeeee))));;;;
-
- vvvvooooiiiidddd ****vvvvaaaalllllllloooocccc ((((ssssiiiizzzzeeee____tttt ssssiiiizzzzeeee))));;;;
-
- vvvvooooiiiidddd ssssssssmmmmaaaalllllllloooocccc____eeeerrrrrrrroooorrrr ((((cccchhhhaaaarrrr ****mmmmeeeessssssssaaaaggggeeee))));;;;
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- The SpeedShop Performance Tools contain a malloc library, -lmalloc_ss,
- which provides tracing and error detection around calls to the various
- malloc routines.
-
- The library provides an intercept layer for calls to _m_a_l_l_o_c, _f_r_e_e,
- _r_e_a_l_l_o_c, _m_e_m_a_l_i_g_n, and _v_a_l_l_o_c; the intercept allows tracing of all calls
- with the SpeedShop performance tools.
-
- Calls to _m_a_l_l_o_c, _f_r_e_e, and _r_e_a_l_l_o_c are passed through to whatever memory
- allocation library the program is linked with. Calls to _c_a_l_l_o_c are
- actually not intercepted, but rely on the underlying calloc to call
- _m_a_l_l_o_c to get the space allocated. Calls to _m_e_m_a_l_i_g_n are implemented by
- allocating a block large enough to hold the aligned area asked for by the
- user, as well as a guard area that holds a flag indicating that the user
- block was obtained through memalign, and the address of the larger block.
- Calls to _v_a_l_l_o_c are translated into a call to getpagesize, followed by a
- memalign call.
-
- The last function, _s_s_m_a_l_l_o_c__e_r_r_o_r is nnnnooootttt a user-accessible function, it
- is an internal static function. It is called whenever any error is
- detected, so that a debugger trap may be placed at exit from that routine
- to interactively examine malloc errors.
-
- MMMMAAAALLLLLLLLOOOOCCCC TTTTRRRRAAAACCCCIIIINNNNGGGG
- The library provides for tracing of all calls to any of the entry points
- listed above, as well as any of the errors listed below. The trace is
- normally captured using a SpeedShop performance experiment. It may be
- written in ASCII to stderr by enabling the environment variable
- _SSMALLOC_TRACING, although this typically produces a great deal of
- output.
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- MMMMAAAALLLLLLLLOOOOCCCC____SSSSSSSS((((3333)))) MMMMAAAALLLLLLLLOOOOCCCC____SSSSSSSS((((3333))))
-
-
-
- EEEERRRRRRRROOOORRRR DDDDEEEETTTTEEEECCCCTTTTIIIIOOOONNNN
- The library will detect some errors under all conditions, and others if
- _SSMALLOC_FASTCHK error detection is enabled. All errors pass through
- the routine _s_s_m_a_l_l_o_c__e_r_r_o_r and a trap can be placed at the exit from that
- routine to catch the problem. Errors are also traced.
-
- The errors that are always detected are:
- _m_a_l_l_o_c call failing (returning NULL).
- _r_e_a_l_l_o_c call failing (returning NULL).
- _r_e_a_l_l_o_c call with an address outside the range of heap addresses
- returned by _m_a_l_l_o_c or _m_e_m_a_l_i_g_n.
- _m_e_m_a_l_i_g_n call with an improper alignment.
- _f_r_e_e call with an address that is improperly aligned.
- _f_r_e_e call with an address outside the range of heap addresses
- returned by _m_a_l_l_o_c or _m_e_m_a_l_i_g_n.
-
- If _SSMALLOC_FASTCHK is enabled, the library will also detect:
- _f_r_e_e or _r_e_a_l_l_o_c calls where the words prior to the user block have
- been corrupted.
- _f_r_e_e or _r_e_a_l_l_o_c calls where the words following the user block have
- been corrupted.
- _f_r_e_e or _r_e_a_l_l_o_c calls where the address is that of a block that has
- already been freed. This error may not always be detected if the
- area around the block is reallocated after it was first freed.
-
- The behavior of the library is governed by various environment variables:
-
- ____SSSSPPPPEEEEEEEEDDDDSSSSHHHHOOOOPPPP____VVVVEEEERRRRBBBBOOOOSSSSEEEE
- If set to a zero-length string, messages are printed to stderr only
- when an error occurs. If set to a non-zero length string), detailed
- information about all traced events, including the callstack at the
- time the error was detected, is printed. This option is not
- normally used by the end user, as it can produce a huge volume of
- output.
-
- ____SSSSSSSSMMMMAAAALLLLLLLLOOOOCCCC____TTTTRRRRAAAACCCCIIIINNNNGGGG
- enables tracing of all calls through the library. Tracing is
- normally done in the course of a performance experiment; the
- variable need not be set in such cases, as the running of the
- experiment will automatically enable it. If the option is enabled
- when the program is run independently, and _SSMALLOC_VERBOSE is set
- to 2 or greater, the trace events and program call stacks will be
- written to stderr.
-
- ____SSSSSSSSMMMMAAAALLLLLLLLOOOOCCCC____FFFFAAAASSSSTTTTCCCCHHHHKKKK
- enables corruption detection for library calls. Corruption
- detection is done by allocating a space larger than the requested
- area, and putting specific patterns in front of and behind the area
- returned to the caller. When _f_r_e_e is called, the patterns are
- checked, and if the area was overwritten, an error message is
- printed using an internal call to the routine _s_s_m_a_l_l_o_c__e_r_r_o_r. Under
- the debugger, a trap may be set at exit from this routine to catch
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- MMMMAAAALLLLLLLLOOOOCCCC____SSSSSSSS((((3333)))) MMMMAAAALLLLLLLLOOOOCCCC____SSSSSSSS((((3333))))
-
-
-
- the program at the error.
-
- ____SSSSSSSSMMMMAAAALLLLLLLLOOOOCCCC____FFFFUUUULLLLLLLLWWWWAAAARRRRNNNN
- enables detection of some calls that are not strictly errors, but
- represent sloppy programming, including _f_r_e_e(NULL), _m_a_l_l_o_c(0), and
- _r_e_a_l_l_o_c(ptr,0).
-
- ____SSSSSSSSMMMMAAAALLLLLLLLOOOOCCCC____MMMMAAAAXXXXMMMMAAAALLLLLLLLOOOOCCCC nnnn
- (where n is a non-zero integer, in any base) sets a maximum size for
- any _m_a_l_l_o_c or _r_e_a_l_l_o_c or _m_e_m_a_l_i_g_n allocation. Any request exceeding
- that size will be flagged as an error, and return a NULL pointer.
- Setting _SSMALLOC_MAXMALLOC to zero disables the test. Note that
- the size argument to malloc is an unsigned variable, and a small
- negative number will be treated as a very large unsigned number, and
- will typically trigger this error if _SSMALLOC_MAXMALLOC is set.
-
- ____SSSSSSSSMMMMAAAALLLLLLLLOOOOCCCC____NNNNOOOO____RRRREEEEUUUUSSSSEEEE
- specifies that no area that has been freed will be reused. With
- this option enabled, no actual _f_r_e_e calls are really made, and the
- process space and swap requirements can grow quite large.
-
- ____SSSSSSSSMMMMAAAALLLLLLLLOOOOCCCC____CCCCLLLLEEEEAAAARRRR____FFFFRRRREEEEEEEE
- will clear the data upon any free call. It will only work if
- _SSMALLOC_FASTCHK is also enabled.
-
- ____SSSSSSSSMMMMAAAALLLLLLLLOOOOCCCC____CCCCLLLLEEEEAAAARRRR____FFFFRRRREEEEEEEE____PPPPAAAATTTTTTTTEEEERRRRNNNN <<<<ppppaaaatttttttteeeerrrrnnnn>>>>
- specifies a pattern to clear the data if _SSMALLOC_CLEAR_FREE is
- enabled. The default pattern is 0xcafebeef for the 32-bit version,
- and 0xcafebeefcafebeef for the 64-bit versions. Only full words
- (double words for 64-bits) are cleared to the pattern.
-
- ____SSSSSSSSMMMMAAAALLLLLLLLOOOOCCCC____CCCCLLLLEEEEAAAARRRR____MMMMAAAALLLLLLLLOOOOCCCC
- will clear the memory area upon each allocation. It also requires
- _SSMALLOC_FASTCHK be enabled.
-
- ____SSSSSSSSMMMMAAAALLLLLLLLOOOOCCCC____CCCCLLLLEEEEAAAARRRR____MMMMAAAALLLLLLLLOOOOCCCC____PPPPAAAATTTTTTTTEEEERRRRNNNN <<<<ppppaaaatttttttteeeerrrrnnnn>>>>
- specifies a pattern to clear the data if _SSMALLOC_CLEAR_MALLOC is
- enabled. The default pattern is 0xfacebeef for the 32-bit version,
- and 0xfacebeeffacebeef for the 64-bit versions. Only full words
- (double words for 64-bits) are cleared to the pattern.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- malloc(3C), malloc(3X), ssrun(1), prof(1), ssdump(1), ssrt(3).
-
- DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
- As ouput from the library routines.
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-